﻿<%@ Control Language="C#" AutoEventWireup="true" Codebehind="UserManagement.ascx.cs"
    Inherits="Portal.Administrator.Users.UserManagement" %>
<%@ Register Assembly="System.Web.Extensions" Namespace="System.Web.UI" TagPrefix="asp" %>

<asp:Label ID="lblUpdateStatus" runat="server"></asp:Label>
<table border="0" cellpadding="2" cellspacing="2" style="width: 100%">
    <tr>
        <td>
            <strong>Tìm:</strong>
            <asp:TextBox ID="txtKeyword" runat="server" Width="231px"></asp:TextBox>
            <strong>Theo:</strong>
            <asp:DropDownList ID="dropSearchBy" runat="server" Width="188px">
                <asp:ListItem Text="Tất cả" Value=""></asp:ListItem>
                <asp:ListItem Text="Tên đăng nhập" Value="Username"></asp:ListItem>
                <asp:ListItem Text="Email" Value="Email"></asp:ListItem>
                <asp:ListItem Text="Họ tên đệm" Value="Email"></asp:ListItem>
                <asp:ListItem Text="Tên" Value="Email"></asp:ListItem>
            </asp:DropDownList>            
            <asp:DropDownList ID="drl_usertype" runat="server" Visible="false">
                <asp:ListItem Text="Quản trị viên" Value="1"></asp:ListItem>
            </asp:DropDownList>
            <asp:Button ID="btnSearch" runat="server" CssClass="Button" Text="Tìm kiếm" OnClick="btnSearch_Click" /></td>
    </tr>
    <tr>
        <td style="height: 23px">
            <strong>Alphabet:</strong>
            <asp:Repeater ID="rptLetters" runat="server" OnItemCommand="rptLetters_ItemCommand">
                <ItemTemplate>
                    <asp:LinkButton ID="lnkLetter" runat="server" CommandName="Alpha"></asp:LinkButton>
                </ItemTemplate>
                <SeparatorTemplate>
                    &nbsp;|&nbsp;</SeparatorTemplate>
            </asp:Repeater>
        </td>
    </tr>
    <tr>
        <td>
            <asp:UpdatePanel ID="upanelGridUserManagemt" runat="server" UpdateMode="Conditional"
                RenderMode="Inline">
                <Triggers>
                    <asp:AsyncPostBackTrigger ControlID="rptLetters" EventName="ItemCommand" />
                    <asp:AsyncPostBackTrigger ControlID="btnSearch" EventName="Click" />
                    <asp:AsyncPostBackTrigger ControlID="btnDeleteSelected" EventName="Click" />
                </Triggers>
                <ContentTemplate>
                    <asp:GridView ID="dtgUsers" runat="server" AutoGenerateColumns="False" BorderColor="Gainsboro"
                        BorderStyle="solid" BorderWidth="1px" CellPadding="2" CssClass="Grid" OnRowCommand="dtgUsers_RowCommand" 
                        Width="100%" AllowPaging="true" AllowSorting="True" OnSorting="dtgUsers_Sorting"
                        OnPreRender="dtgUsers_PreRender" OnPageIndexChanging="dtgUsers_PageIndexChanging" PageSize="20">
                        <AlternatingRowStyle CssClass="Grid_Raw2"/>
                        <RowStyle CssClass="Grid_Raw1" />
                        <HeaderStyle CssClass="Grid_Top" Font-Bold="True" />
                        <Columns>
                            <asp:TemplateField SortExpression="User_ID" Visible="False">
                                <ItemTemplate>
                                    <asp:Label ID="lblKey" runat="server" Text='<%# Eval("UserID") %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField>
                                <HeaderTemplate>
                                    <asp:CheckBox runat="server" ID="chkAll" onclick="Check(this,'dtgUsers');highlightChkBxRow(this);" />
                                </HeaderTemplate>
                                <ItemStyle HorizontalAlign="Center" />
                                <ItemTemplate>
                                    <asp:CheckBox runat="server" ID="DeleteThis" onclick="javascript: highlightChkBxRow(this);" />
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:BoundField DataField="Username" HeaderText="T&#234;n truy cập" SortExpression="Username" />
                            <asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email" />
                            <asp:BoundField DataField="FirstName" HeaderText="T&#234;n" SortExpression="FirstName" />
                            <asp:BoundField DataField="LastName" HeaderText="Họ đệm" SortExpression="LastName" />
                            <asp:BoundField DataField="RoleDescription" HeaderText="Nh&#243;m" SortExpression="RoleDescription" />
                            <asp:TemplateField HeaderText="Thao t&#225;c">
                                <ItemStyle HorizontalAlign="Center" />
                                <ItemTemplate>
                                    <asp:ImageButton ID="btnImgManageProfile" ImageUrl="~/Administrator/Images/GridView/edit.gif"
                                        runat="server" CommandArgument='<%# Eval("UserID") %>' CommandName="manageprofile"
                                        ToolTip="Sửa" />
                                    &nbsp;
                                    <asp:ImageButton ID="btnImgManagePassword" ImageUrl="~/Administrator/Images/GridView/password.gif"
                                        runat="server" CommandArgument='<%# Eval("UserID") %>' CommandName="managepassword"
                                        ToolTip="Mật khẩu" />
                                    &nbsp;
                                    <asp:ImageButton ID="btnImgUserPermision" ImageUrl="~/Administrator/Images/GridView/role.gif"
                                        runat="server" CommandArgument='<%# Eval("UserID") %>' CommandName="userpermision"
                                        ToolTip="Phân quyền"  />
                                    &nbsp;
                                    <asp:ImageButton ID="btnImgDeleteUser" ImageUrl="~/Administrator/Images/GridView/delete.gif"
                                        runat="server" CommandArgument='<%# Eval("UserID") %>' CommandName="deleteuser"
                                        ToolTip="Xóa" />                                   
                                </ItemTemplate>
                            </asp:TemplateField>
                        </Columns>
                        <PagerTemplate>
                            <table id="tbPager" width="100%">
                                <tr>
                                    <td>
                                        Page
                                        <asp:DropDownList ID="ddlNumberPages" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlNumberPages_SelectedIndexChanged">
                                        </asp:DropDownList>
                                        of
                                        <asp:Label ID="lbTotalPages" runat="server"></asp:Label></td>
                                    <td>
                                        <asp:DropDownList ID="ddlPageItems" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlPageItems_SelectedIndexChanged">
                                            <asp:ListItem>5</asp:ListItem>
                                            <asp:ListItem Selected="True">10</asp:ListItem>
                                            <asp:ListItem>20</asp:ListItem>
                                        </asp:DropDownList></td>
                                    <td align="right">
                                        <asp:LinkButton ID="lbtnFirst" runat="server" CausesValidation="false" CommandName="Page"
                                            CommandArgument="First" Text="<<"></asp:LinkButton>&nbsp;
                                        <asp:LinkButton ID="lbtnPrev" runat="server" CausesValidation="false" CommandName="Page"
                                            CommandArgument="Prev" Text="Prev"></asp:LinkButton>&nbsp;
                                        <asp:LinkButton ID="lbtnNext" runat="server" CausesValidation="false" CommandName="Page"
                                            CommandArgument="Next" Text="Next"></asp:LinkButton>&nbsp;
                                        <asp:LinkButton ID="lbtnLast" runat="server" CausesValidation="false" CommandName="Page"
                                            CommandArgument="Last" Text=">>"></asp:LinkButton></td>
                                </tr>
                            </table>
                        </PagerTemplate>
                        <EmptyDataTemplate>
                            There was no data to return
                        </EmptyDataTemplate>
                        <PagerSettings Mode="NumericFirstLast" />
                    </asp:GridView>
                </ContentTemplate>
            </asp:UpdatePanel>
        </td>
    </tr>
    <tr>
        <td style="height: 28px">
            <asp:Button ID="btnDeleteSelected" runat="server" CssClass="Button" OnClientClick="return confirmMsg(this.form)"
                Text="Delete" OnClick="btnDeleteSelected_Click" />
            <asp:Button ID="btnAddUser" runat="server" CssClass="Button" OnClick="btnAddUser_Click"
                Text="Tạo thành viên quản trị" />
            <asp:Button ID="btnAddUserDaibieu" Visible="false" runat="server" CssClass="Button" OnClick="btnAddUserDaiBieu_Click"
                Text="Tạo thành viên đại biểu" />
        </td>
    </tr>
</table>
